Remove GtkBuiltinIcon
authorTimm Bäder <mail@baedert.org>
Tue, 16 May 2017 07:45:53 +0000 (09:45 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 20 Jul 2017 01:27:13 +0000 (21:27 -0400)
Now unused.

12 files changed:
gtk/Makefile.am
gtk/gtkbuiltinicon.c [deleted file]
gtk/gtkbuiltiniconprivate.h [deleted file]
gtk/gtkcheckbutton.c
gtk/gtkcheckmenuitem.c
gtk/gtkexpander.c
gtk/gtkicon.c
gtk/gtkmenu.c
gtk/gtknotebook.c
gtk/gtkrange.c
gtk/gtkspinner.c
gtk/meson.build

index 73b8b9252d06e10ed51473ca787a2d43fea98fcf..408eddecd468a37eed16182b997d00e9f53b8c42 100644 (file)
@@ -376,7 +376,6 @@ gtk_private_h_sources =             \
        gtkboxprivate.h         \
        gtkboxgadgetprivate.h   \
        gtkbuilderprivate.h     \
-       gtkbuiltiniconprivate.h \
        gtkbuttonprivate.h      \
        gtkcellareaboxcontextprivate.h  \
        gtkcheckbuttonprivate.h \
@@ -627,7 +626,6 @@ gtk_base_c_sources =                \
        gtkbuilder.c            \
        gtkbuilderparser.c      \
        gtkbuilder-menus.c      \
-       gtkbuiltinicon.c        \
        gtkbutton.c             \
        gtkcalendar.c           \
        gtkcellarea.c           \
diff --git a/gtk/gtkbuiltinicon.c b/gtk/gtkbuiltinicon.c
deleted file mode 100644 (file)
index 60003b6..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright © 2015 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Benjamin Otte <otte@gnome.org>
- */
-
-#include "config.h"
-
-#include "gtkbuiltiniconprivate.h"
-
-#include "gtkcssnodeprivate.h"
-#include "gtkcssnumbervalueprivate.h"
-#include "gtkrendericonprivate.h"
-#include "gtksnapshot.h"
-
-/* GtkBuiltinIcon is a gadget implementation that is meant to replace
- * all calls to gtk_render_ functions to render arrows, expanders, checks
- * radios, handles, separators, etc. See the GtkCssImageBuiltinType
- * enumeration for the full set of builtin icons that this gadget can
- * render.
- *
- * Use gtk_builtin_icon_set_image to set which of the builtin icons
- * is rendered.
- *
- * Use gtk_builtin_icon_set_default_size to set a non-zero default
- * size for the icon.
- *
- * Themes can override the acutal image that is used with the
- * -gtk-icon-source property. If it is not specified, a builtin
- * fallback is used.
- */
-
-typedef struct _GtkBuiltinIconPrivate GtkBuiltinIconPrivate;
-struct _GtkBuiltinIconPrivate {
-  GtkCssImageBuiltinType        image_type;
-  int                           default_size;
-  int                           strikethrough;
-  gboolean                      strikethrough_valid;
-};
-
-G_DEFINE_TYPE_WITH_CODE (GtkBuiltinIcon, gtk_builtin_icon, GTK_TYPE_CSS_GADGET,
-                         G_ADD_PRIVATE (GtkBuiltinIcon))
-
-static void
-gtk_builtin_icon_get_preferred_size (GtkCssGadget   *gadget,
-                                     GtkOrientation  orientation,
-                                     gint            for_size,
-                                     gint           *minimum,
-                                     gint           *natural,
-                                     gint           *minimum_baseline,
-                                     gint           *natural_baseline)
-{
-  GtkBuiltinIconPrivate *priv = gtk_builtin_icon_get_instance_private (GTK_BUILTIN_ICON (gadget));
-  double min_size;
-  guint property;
-
-  if (orientation == GTK_ORIENTATION_HORIZONTAL)
-    property = GTK_CSS_PROPERTY_MIN_WIDTH;
-  else
-    property = GTK_CSS_PROPERTY_MIN_HEIGHT;
-  min_size = _gtk_css_number_value_get (gtk_css_style_get_value (gtk_css_gadget_get_style (gadget), property), 100);
-  if (min_size > 0.0)
-    {
-      *minimum = *natural = min_size;
-    }
-  else
-    {
-      *minimum = *natural = priv->default_size;
-    }
-
-  if (minimum_baseline)
-    {
-      if (!priv->strikethrough_valid)
-        {
-          GtkWidget *widget;
-          PangoContext *pango_context;
-          const PangoFontDescription *font_desc;
-          PangoFontMetrics *metrics;
-
-          widget = gtk_css_gadget_get_owner (gadget);
-          pango_context = gtk_widget_get_pango_context (widget);
-          font_desc = pango_context_get_font_description (pango_context);
-
-          metrics = pango_context_get_metrics (pango_context,
-                                               font_desc,
-                                               pango_context_get_language (pango_context));
-          priv->strikethrough = pango_font_metrics_get_strikethrough_position (metrics);
-          priv->strikethrough_valid = TRUE;
-
-          pango_font_metrics_unref (metrics);
-        }
-
-      *minimum_baseline = *minimum * 0.5 + PANGO_PIXELS (priv->strikethrough);
-    }
-
-  if (natural_baseline)
-    *natural_baseline = *minimum_baseline;
-}
-
-static void
-gtk_builtin_icon_allocate (GtkCssGadget        *gadget,
-                           const GtkAllocation *allocation,
-                           int                  baseline,
-                           GtkAllocation       *out_clip)
-{
-  GdkRectangle icon_clip;
-
-  GTK_CSS_GADGET_CLASS (gtk_builtin_icon_parent_class)->allocate (gadget, allocation, baseline, out_clip);
-
-  gtk_css_style_render_icon_get_extents (gtk_css_gadget_get_style (gadget),
-                                         &icon_clip,
-                                         allocation->x, allocation->y,
-                                         allocation->width, allocation->height);
-  gdk_rectangle_union (out_clip, &icon_clip, out_clip);
-}
-
-static gboolean
-gtk_builtin_icon_snapshot (GtkCssGadget *gadget,
-                           GtkSnapshot  *snapshot,
-                           int           x,
-                           int           y,
-                           int           width,
-                           int           height)
-{
-  GtkBuiltinIconPrivate *priv = gtk_builtin_icon_get_instance_private (GTK_BUILTIN_ICON (gadget));
-
-  gtk_snapshot_offset (snapshot, x, y);
-  gtk_css_style_snapshot_icon (gtk_css_gadget_get_style (gadget),
-                               snapshot,
-                               width, height,
-                               priv->image_type);
-  gtk_snapshot_offset (snapshot, -x, -y);
-
-  return FALSE;
-}
-
-static void
-gtk_builtin_icon_style_changed (GtkCssGadget      *gadget,
-                                GtkCssStyleChange *change)
-{
-  GtkBuiltinIconPrivate *priv = gtk_builtin_icon_get_instance_private (GTK_BUILTIN_ICON (gadget));
-
-  if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))
-    priv->strikethrough_valid = FALSE;
-
-  GTK_CSS_GADGET_CLASS (gtk_builtin_icon_parent_class)->style_changed (gadget, change);
-}
-
-static void
-gtk_builtin_icon_class_init (GtkBuiltinIconClass *klass)
-{
-  GtkCssGadgetClass *gadget_class = GTK_CSS_GADGET_CLASS (klass);
-
-  gadget_class->get_preferred_size = gtk_builtin_icon_get_preferred_size;
-  gadget_class->allocate = gtk_builtin_icon_allocate;
-  gadget_class->snapshot = gtk_builtin_icon_snapshot;
-  gadget_class->style_changed = gtk_builtin_icon_style_changed;
-}
-
-static void
-gtk_builtin_icon_init (GtkBuiltinIcon *custom_gadget)
-{
-}
-
-GtkCssGadget *
-gtk_builtin_icon_new_for_node (GtkCssNode *node,
-                               GtkWidget  *owner)
-{
-  return g_object_new (GTK_TYPE_BUILTIN_ICON,
-                       "node", node,
-                       "owner", owner,
-                       NULL);
-}
-
-GtkCssGadget *
-gtk_builtin_icon_new (const char   *name,
-                      GtkWidget    *owner,
-                      GtkCssGadget *parent,
-                      GtkCssGadget *next_sibling)
-{
-  GtkCssNode *node;
-  GtkCssGadget *result;
-
-  node = gtk_css_node_new ();
-  gtk_css_node_set_name (node, g_intern_string (name));
-  if (parent)
-    gtk_css_node_insert_before (gtk_css_gadget_get_node (parent),
-                                node,
-                                next_sibling ? gtk_css_gadget_get_node (next_sibling) : NULL);
-
-  result = gtk_builtin_icon_new_for_node (node, owner);
-
-  g_object_unref (node);
-
-  return result;
-}
-
-void
-gtk_builtin_icon_set_image (GtkBuiltinIcon         *icon,
-                            GtkCssImageBuiltinType  image)
-{
-  GtkBuiltinIconPrivate *priv;
-  
-  g_return_if_fail (GTK_IS_BUILTIN_ICON (icon));
-
-  priv = gtk_builtin_icon_get_instance_private (icon);
-
-  if (priv->image_type != image)
-    {
-      priv->image_type = image;
-      gtk_widget_queue_draw (gtk_css_gadget_get_owner (GTK_CSS_GADGET (icon)));
-    }
-}
-
-GtkCssImageBuiltinType
-gtk_builtin_icon_get_image (GtkBuiltinIcon *icon)
-{
-  GtkBuiltinIconPrivate *priv;
-
-  g_return_val_if_fail (GTK_IS_BUILTIN_ICON (icon), GTK_CSS_IMAGE_BUILTIN_NONE);
-
-  priv = gtk_builtin_icon_get_instance_private (icon);
-
-  return priv->image_type;
-}
-
-void
-gtk_builtin_icon_set_default_size (GtkBuiltinIcon *icon,
-                                   int             default_size)
-{
-  GtkBuiltinIconPrivate *priv;
-  
-  g_return_if_fail (GTK_IS_BUILTIN_ICON (icon));
-
-  priv = gtk_builtin_icon_get_instance_private (icon);
-
-  if (priv->default_size != default_size)
-    {
-      priv->default_size = default_size;
-      gtk_widget_queue_resize (gtk_css_gadget_get_owner (GTK_CSS_GADGET (icon)));
-    }
-}
-
-int
-gtk_builtin_icon_get_default_size (GtkBuiltinIcon *icon)
-{
-  GtkBuiltinIconPrivate *priv;
-
-  g_return_val_if_fail (GTK_IS_BUILTIN_ICON (icon), GTK_CSS_IMAGE_BUILTIN_NONE);
-
-  priv = gtk_builtin_icon_get_instance_private (icon);
-
-  return priv->default_size;
-}
diff --git a/gtk/gtkbuiltiniconprivate.h b/gtk/gtkbuiltiniconprivate.h
deleted file mode 100644 (file)
index 5da73ef..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright © 2015 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: Benjamin Otte <otte@gnome.org>
- */
-
-#ifndef __GTK_BUILTIN_ICON_PRIVATE_H__
-#define __GTK_BUILTIN_ICON_PRIVATE_H__
-
-#include "gtk/gtkcssgadgetprivate.h"
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_BUILTIN_ICON           (gtk_builtin_icon_get_type ())
-#define GTK_BUILTIN_ICON(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_BUILTIN_ICON, GtkBuiltinIcon))
-#define GTK_BUILTIN_ICON_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_BUILTIN_ICON, GtkBuiltinIconClass))
-#define GTK_IS_BUILTIN_ICON(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_BUILTIN_ICON))
-#define GTK_IS_BUILTIN_ICON_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_BUILTIN_ICON))
-#define GTK_BUILTIN_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BUILTIN_ICON, GtkBuiltinIconClass))
-
-typedef struct _GtkBuiltinIcon           GtkBuiltinIcon;
-typedef struct _GtkBuiltinIconClass      GtkBuiltinIconClass;
-
-struct _GtkBuiltinIcon
-{
-  GtkCssGadget parent;
-};
-
-struct _GtkBuiltinIconClass
-{
-  GtkCssGadgetClass  parent_class;
-};
-
-GType                   gtk_builtin_icon_get_type               (void) G_GNUC_CONST;
-
-GtkCssGadget *          gtk_builtin_icon_new                    (const char             *name,
-                                                                 GtkWidget              *owner,
-                                                                 GtkCssGadget           *parent,
-                                                                 GtkCssGadget           *next_sibling);
-GtkCssGadget *          gtk_builtin_icon_new_for_node           (GtkCssNode             *node,
-                                                                 GtkWidget              *owner);
-
-void                    gtk_builtin_icon_set_image              (GtkBuiltinIcon         *icon,
-                                                                 GtkCssImageBuiltinType  image);
-GtkCssImageBuiltinType  gtk_builtin_icon_get_image              (GtkBuiltinIcon         *icon);
-void                    gtk_builtin_icon_set_default_size       (GtkBuiltinIcon         *icon,
-                                                                 int                     default_size);
-int                     gtk_builtin_icon_get_default_size       (GtkBuiltinIcon         *icon);
-
-G_END_DECLS
-
-#endif /* __GTK_BUILTIN_ICON_PRIVATE_H__ */
index 0dde2befb1dd93f044847e67b3ba1037f9dd5802..3881db55dd6337c5a5b8f1a0cd8dd648c5cf90df 100644 (file)
@@ -33,7 +33,6 @@
 #include "gtkprivate.h"
 #include "gtkrender.h"
 #include "gtkwidgetprivate.h"
-#include "gtkbuiltiniconprivate.h"
 #include "gtkcssnodeprivate.h"
 #include "gtkcontainerprivate.h"
 #include "gtkstylecontextprivate.h"
index 4483e684b7c55724ee177f67ff2fb3faa8fa9cc5..e9928eb5d0fe383d0743d8ca43018ad29b6c274d 100644 (file)
@@ -23,7 +23,6 @@
  */
 
 #include "config.h"
-#include "gtkbuiltiniconprivate.h"
 #include "gtkcheckmenuitemprivate.h"
 #include "gtkmenuitemprivate.h"
 #include "gtkaccellabel.h"
index 011c92955b4f6e761d28c6c23558abaffeeeb21c..711be4c63ee0af8f8a833c1fe6db5196ae93fbe5 100644 (file)
 #include "gtkdnd.h"
 #include "a11y/gtkexpanderaccessible.h"
 #include "gtkstylecontextprivate.h"
-#include "gtkbuiltiniconprivate.h"
 #include "gtkwidgetprivate.h"
 #include "gtkcontainerprivate.h"
 #include "gtkiconprivate.h"
index 307bb06636ac0552cfe4feadccfe36b4dd78d6fc..3591a30ab07c3750e2d5fc86d9572f27d5110433 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "config.h"
 
-#include "gtkbuiltiniconprivate.h"
 #include "gtkcssnodeprivate.h"
 #include "gtkiconprivate.h"
 #include "gtkwidgetprivate.h"
index b27f9f2a9b19314e846cf550f7a0b5e3d83ec2a3..b9b15c3c36cb993359cb7f2536bd05d8afd41eca 100644 (file)
 #include "gtkaccelmap.h"
 #include "gtkadjustment.h"
 #include "gtkbindings.h"
-#include "gtkbuiltiniconprivate.h"
 #include "gtkcheckmenuitem.h"
 #include "gtkcheckmenuitemprivate.h"
 #include "gtkmain.h"
index 4fd55ed5d318c238efc6f028ea482d00d2fdc155..660957832a46a5b7457941bf889a6fb4c254a23c 100644 (file)
@@ -43,7 +43,6 @@
 #include "gtkbuildable.h"
 #include "gtktypebuiltins.h"
 #include "gtkwidgetpath.h"
-#include "gtkbuiltiniconprivate.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtksizerequest.h"
 #include "gtkstylecontextprivate.h"
index 9e572db11e5d99427255824b463c5f22a6fdcecc..493fda8a9d20ff93a20dc7be8c1540d4888f5545 100644 (file)
@@ -32,7 +32,6 @@
 #include "gtkrangeprivate.h"
 
 #include "gtkadjustmentprivate.h"
-#include "gtkbuiltiniconprivate.h"
 #include "gtkcolorscaleprivate.h"
 #include "gtkintl.h"
 #include "gtkgesturelongpressprivate.h"
index 9879be242420dc2ed752c54506e155b6fd6d4240..d5f1f2a95abc2f774ac619feaafda53e4e72baf8 100644 (file)
@@ -38,7 +38,6 @@
 #include "gtkstylecontextprivate.h"
 #include "gtkwidgetprivate.h"
 #include "a11y/gtkspinneraccessible.h"
-#include "gtkbuiltiniconprivate.h"
 #include "gtkcssnumbervalueprivate.h"
 #include "gtkrendericonprivate.h"
 
index a741b7d49d4f5ef41264b9f1a0d9ce638a581e5f..878539433d95a61f93f2190729fb0b675357e95d 100644 (file)
@@ -40,7 +40,6 @@ gtk_public_sources = files([
   'gtkbuilder-menus.c',
   'gtkbuilder.c',
   'gtkbuilderparser.c',
-  'gtkbuiltinicon.c',
   'gtkbutton.c',
   'gtkcalendar.c',
   'gtkcellarea.c',